package com.touni.lambda;

import java.util.function.Supplier;

/**
 * @ClassName : DIYBaseSupplier
 * @Description :
 * @Author : lwq
 * @Date: 2020-11-03 15:47
 */
public class DIYBaseSupplier  implements Supplier<Integer> {

    private int previous = 0;
    private int current = 1;

    @Override
    public Integer get(){
        int oldPrevious = this.previous;
        int nextValue = this.previous + this.current;
        this.previous = this.current;
        this.current = nextValue;
        return oldPrevious;
    }
}
